package com.victualler.core.config.dict.controller.impl;

import com.victualler.core.base.controller.impl.BaseRestControllerImpl;

import com.victualler.core.config.dict.controller.DictController;
import com.victualler.core.config.dict.entity.DictDao;
import com.victualler.core.config.dict.dto.*;
import com.victualler.core.config.dict.repository.DictQueryRepository;
import com.victualler.core.config.dict.repository.DictRepository;
import com.victualler.core.config.dict.service.DictService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: Guoshichang
 * @Date: Create in 19:13 2018/4/5
 * @Discription:    字典实体对应的RestContoller
 */
@RestController
@RequestMapping("/config/dict")
public class DictControllerImpl extends BaseRestControllerImpl<DictDao,DictRepository,DictQueryRepository,DictService> implements DictController {
    @RequestMapping("findTop")
    @Override
    public List<DictTopDto> getDictTopDto() {
        return this.baseService.getDictTopDtoList();
    }

    @RequestMapping("findTopLike")
    @Override
    public List<DictTopDto> getDictTopDto(@RequestParam("codeType") String codeType) {
        return this.baseService.getDictTopDtoList(codeType);
    }

    @RequestMapping("findByType")
    @Override
    public List<DictDao> getDictByType(@RequestBody String CodeType) {
       return this.baseService.getDictByCodeType(CodeType);
    }
}
